class Solution {
public:
    int firstUniqChar(string s) {
        //计数排序思路
        int count[26] = {0};
        for(size_t i = 0;i < s.size();i++)
        {
            count[s[i]-'a']++;
        }
        for(size_t i = 0;i < s.size();i++)
        {
            if(count[s[i]-'a'] == 1)
            {
                return i;
            }
        }
        return -1;
    }
};